package com.sk.ccflower.server.lib.sockUtils.nio;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;


public class NioSock extends BaseNioSock{


	private String ip;
	private int port;

	public NioSock(String ip , int port){
		this.ip = ip;
		this.port = port;
	}

	public void connect() throws IOException{
		this.selector= Selector.open();
		InetSocketAddress address = new InetSocketAddress(this.ip , this.port);
		this.sc = SocketChannel.open(address);
		this.register(this.sc , SelectionKey.OP_CONNECT | SelectionKey.OP_WRITE | SelectionKey.OP_READ);
		//this.sc.connect(address);
		//this.sc.open(address);

	}
}
